/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.peluq.model.entity;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Diego_M
 */
@Entity
@Table(name = "det_reservatur", catalog = "peludb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DetReservatur.findAll", query = "SELECT d FROM DetReservatur d"),
    @NamedQuery(name = "DetReservatur.findByCliCod", query = "SELECT d FROM DetReservatur d WHERE d.detReservaturPK.cliCod = :cliCod"),
    @NamedQuery(name = "DetReservatur.findByCiEmp", query = "SELECT d FROM DetReservatur d WHERE d.detReservaturPK.ciEmp = :ciEmp"),
    @NamedQuery(name = "DetReservatur.findByReCob", query = "SELECT d FROM DetReservatur d WHERE d.detReservaturPK.reCob = :reCob"),
    @NamedQuery(name = "DetReservatur.findByCantidad", query = "SELECT d FROM DetReservatur d WHERE d.cantidad = :cantidad"),
    @NamedQuery(name = "DetReservatur.findByPrecio", query = "SELECT d FROM DetReservatur d WHERE d.precio = :precio")})
public class DetReservatur implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected DetReservaturPK detReservaturPK;
    @Column(name = "cantidad")
    private Integer cantidad;
    @Column(name = "precio")
    private Integer precio;
    @JoinColumns({
        @JoinColumn(name = "cli_cod", referencedColumnName = "cli_cod", nullable = false, insertable = false, updatable = false),
        @JoinColumn(name = "ci_emp", referencedColumnName = "ci_emp", nullable = false, insertable = false, updatable = false),
        @JoinColumn(name = "re_cob", referencedColumnName = "re_cob", nullable = false, insertable = false, updatable = false)})
    @OneToOne(optional = false)
    private ReservaTurno reservaTurno;

    public DetReservatur() {
    }

    public DetReservatur(DetReservaturPK detReservaturPK) {
        this.detReservaturPK = detReservaturPK;
    }

    public DetReservatur(int cliCod, int ciEmp, int reCob) {
        this.detReservaturPK = new DetReservaturPK(cliCod, ciEmp, reCob);
    }

    public DetReservaturPK getDetReservaturPK() {
        return detReservaturPK;
    }

    public void setDetReservaturPK(DetReservaturPK detReservaturPK) {
        this.detReservaturPK = detReservaturPK;
    }

    public Integer getCantidad() {
        return cantidad;
    }

    public void setCantidad(Integer cantidad) {
        this.cantidad = cantidad;
    }

    public Integer getPrecio() {
        return precio;
    }

    public void setPrecio(Integer precio) {
        this.precio = precio;
    }

    public ReservaTurno getReservaTurno() {
        return reservaTurno;
    }

    public void setReservaTurno(ReservaTurno reservaTurno) {
        this.reservaTurno = reservaTurno;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (detReservaturPK != null ? detReservaturPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DetReservatur)) {
            return false;
        }
        DetReservatur other = (DetReservatur) object;
        if ((this.detReservaturPK == null && other.detReservaturPK != null) || (this.detReservaturPK != null && !this.detReservaturPK.equals(other.detReservaturPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.peluq.model.entity.DetReservatur[ detReservaturPK=" + detReservaturPK + " ]";
    }
    
}
